<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMybankVostroBillTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('mybank_vostro_bill', function (Blueprint $table) {
            $table->id();
            $table->string('isvOrgId', 64)->default('')->comment('合作方机构号（网商银行分配）');
            $table->string('merchantId', 64)->default('')->comment('商户号');
            $table->string('outTradeNo', 64)->default('')->comment('原外部订单请求流水号');
            $table->string('orderNo', 64)->default('')->comment('原网商订单号');
            $table->string('transNo', 64)->default('')->comment('入账流水号');
            $table->string('channelId', 24)->default('')->comment('出款渠道id（9001大额、9002小额、9003超网、9100支付宝）');
            $table->string('payerBankId', 128)->default('')->comment('付款方银行编码');
            $table->string('payerCardNo', 64)->default('')->comment('付款方卡号');
            $table->string('payerCardName', 128)->default('')->comment('付款方卡号户名');
            $table->string('payeeCardNo', 64)->default('')->comment('收款方卡号');
            $table->string('payeeCardName', 128)->default('')->comment('收款方户名');
            $table->string('vostroType', 64)->default('')->comment('来账类型');
            $table->string('vostroScene', 64)->default('')->comment('来账场景');
            $table->unsignedInteger('amount')->default(0)->comment('订单金额(金额为分)');
            $table->unsignedInteger('transferDate')->default(0)->comment('转账时间,提现完成时间');
            $table->string('currency', 20)->default('')->comment('币种，默认CNY');
            $table->string('memo', 255)->default('')->comment('备注');
            $table->string('extInfo', 255)->default('')->comment('扩展信息');
            $table->string('status', 255)->default('')->comment('状态');
            $table->string('remark', 255)->default('')->comment('转账附言');
            $table->tinyInteger("flagMark")->default(0)->comment("标记 0:未匹配,1:已匹配");
            $table->unsignedInteger('type')->default(0)->comment('类型 0:渠道结算入账,1:充值,2:提现,3:充值退款（提现的另一种）');
            $table->unsignedInteger('platformFee')->default(0)->comment('平台设置提现手续用（银行控制盖帽比率），用户实收资金= TotalAmount - PlatformFee');
            $table->string('feeCurrency', 20)->default('')->comment('币种，默认CNY');
            $table->unsignedInteger('withdrawApplyDate')->default(0)->comment('提现时间');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');
            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '网商银行账户明细';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('mybank_vostro_bill');
    }
}
